package com.atguigu.mapreduce.jvm;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2021/11/28 16:25
 * @description:
 */
public class NewStringTest {

    /**
     *  0 new #2 <java/lang/String>
     *  3 dup
     *  4 aload_1
     *  5 invokespecial #3 <java/lang/String.<init> : (Ljava/lang/String;)V>
     *  8 astore_2
     *  9 aload_2
     * 10 areturn
     *
     *
     *  0 ldc #2 <abc>
     *  2 astore_2
     *  3 new #3 <java/lang/String>
     *  6 dup
     *  7 aload_1
     *  8 invokespecial #4 <java/lang/String.<init> : (Ljava/lang/String;)V>
     * 11 astore_3
     * 12 new #3 <java/lang/String>
     * 15 dup
     * 16 aload_2
     * 17 invokespecial #4 <java/lang/String.<init> : (Ljava/lang/String;)V>
     * 20 astore 4
     * 22 new #5 <java/lang/StringBuilder>
     * 25 dup
     * 26 invokespecial #6 <java/lang/StringBuilder.<init> : ()V>
     * 29 aload_3
     * 30 invokevirtual #7 <java/lang/StringBuilder.append : (Ljava/lang/String;)Ljava/lang/StringBuilder;>
     * 33 aload 4
     * 35 invokevirtual #7 <java/lang/StringBuilder.append : (Ljava/lang/String;)Ljava/lang/StringBuilder;>
     * 38 invokevirtual #8 <java/lang/StringBuilder.toString : ()Ljava/lang/String;>
     * 41 astore 5
     * 43 aload 5
     * 45 areturn
     *
     * @param str
     * @return
     */
    public String getStr(String str) {

        String src = "abc";
        String res = new String(str);
        String res1 = new String(src);
        String s = res + res1;
        return s;
    }

}

